package com.springboot.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.springboot.pojo.Person_1;
@Service
public class PersonHystrixService_1 {
	@Autowired
	PersonService_1 personService;
	@HystrixCommand(fallbackMethod="fallbackSave")
	public List<Person_1> save(String name){
		try {
			return personService.save(name);
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}
	public List<Person_1> fallbackSave(String name){
		List<Person_1> list=new ArrayList<Person_1>();
		Person_1 p=new Person_1("person service 故障");
		list.add(p);
		return list;
	}
}
